//
//  WQRightImageBtn.m
//  QLYuQingPersonal
//
//  Created by 魏强 on 17/6/17.
//  Copyright © 2017年 KDTech. All rights reserved.
//

#import "WQRightImageBtn.h"

@implementation WQRightImageBtn

- (void)setImageAndTitleLeft:(float)spacing {
    CGSize imageSize = self.imageView.frame.size;
    CGSize titleSize = self.titleLabel.frame.size;
    
    CGFloat totalWidth = (imageSize.width + titleSize.width + spacing);
    
    self.imageEdgeInsets = UIEdgeInsetsMake( 0.0, (totalWidth - imageSize.width), 0.0, - titleSize.width);
    
    self.titleEdgeInsets = UIEdgeInsetsMake( 0.0, - (totalWidth - titleSize.width), 0.0, (totalWidth - titleSize.width));
}

- (void)setImageAndTitleLeft{
    const int SPACING = 1.0f;
    [self setImageAndTitleLeft:SPACING];
}
- (void)layoutSubviews{
    [super layoutSubviews];
    [self setImageAndTitleLeft];
    
}

@end
